<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title> vf</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link rel="StyleSheet" href="<%=request.getContextPath()%>/css/dtree.css" type="text/css">
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/dtree.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        initBookSort();
    });

    function initBookSort(){
        $.getJSON("<%=request.getContextPath()%>/getBookSorts","",showBookSorts);
    }
    function showBookSorts(data){
        console.log(data)
        document.write("<body style=\"background:#fff;\"><div class=\"dtree\" >");
        d = new dTree('d');

        d.add(1,-1,'类别','booklist.jsp?sortId=-1','类别','bookFrame');
        $(data).each(function () {
            d.add("\""+this.sort_id+"\"",1,this.sort_name,'booklist.jsp?sortId='+this.sort_id,this.sort_name,'bookFrame');
        });
        document.write(d);
        document.write("</div></body>")
    }
</script>
</head>

</html>
